package youcheng.work.view_zhexian;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;
import youcheng.work.view_zhexian.utils.BaseActivity;

public class SelActivity extends BaseActivity {
/* 通过布局里控件的id来声明绑定到activity里来使用*/
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.imgv_return)
    ImageView imgv_return;
    @BindView(R.id.bt0)
    Button bt0;
    @BindView(R.id.bt1)
    Button bt1;
    private ImageView spp_bt;
    private ImageView ble_bt;
    private ImageView abt_us;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sel);
        ButterKnife.bind(this);//==一切findViewById()

        //0

        tvTitle.setText("首页");
        imgv_return.setVisibility(View.INVISIBLE);

        bt0.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(SelActivity.this, AddActivity.class));
            }
        });

        bt1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(SelActivity.this, MainActivity.class));
            }
        });

        spp_bt=findViewById(R.id.bluetooth_spp_start);
        spp_bt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(SelActivity.this, BlueToothActivity.class);
                startActivity(intent);
            }
        });

        ble_bt=findViewById(R.id.bluetooth_ble_start);
        ble_bt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent=new Intent(SelActivity.this, BLEDeviceListActivity.class);
                startActivity(intent);
            }
        });



        abt_us=findViewById(R.id.aboutus);
        abt_us.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Uri uri = Uri.parse("https://gitee.com/zhu-kaifa/4g_dial_up");
                //startActivity(new Intent(Intent.ACTION_VIEW,uri));
                Intent it = new Intent(Intent.ACTION_VIEW, uri);
                startActivity(it);
            }
        });
    }

}